#! /bin/zsh
 
# MPD/MPC by olshrimpeyes
nowplaying=`mpc | grep - | sed -e 's/\&/&amp;/g'`
playing=`mpc | grep playing`
 
print "<openbox_pipe_menu>"
print "<item label=\"Music Player\"><action name=\"Execute\"><execute>$TERM -e ncmpcpp</execute></action></item>"
print "<separator/>"
if  [[ -z $nowplaying ]]
 
then
 
print "<item label=\"Not Playing\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
 
else
 
print "<item label=\""$nowplaying"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
 
if [[ -z $playing ]]
 
then
 
print "<item label=\"Paused\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
 
else
 
print "<item label=\""$playing"\"><action name=\"Execute\"><execute>mpc</execute></action></item>"
 
fi
 
fi
 
print "<separator/>"
 
if [[ -z $playing ]]
 
then
 
print "<item label=\"Play\"><action name=\"Execute\"><execute>mpc play</execute></action></item>"
 
else
 
print "<item label=\"Pause\"><action name=\"Execute\"><execute>mpc pause</execute></action></item>"
print "<item label=\"Stop\"><action name=\"Execute\"><execute>mpc stop</execute></action></item>"
 
fi
 
print "<item label=\"Next\"><action name=\"Execute\"><execute>mpc next</execute></action></item>"
print "<item label=\"Previous\"><action name=\"Execute\"><execute>mpc prev</execute></action></item>"
print "<item label=\"Volume\"><action name=\"Execute\"><execute>$TERM -e alsamixer</execute></action></item>"
print "</openbox_pipe_menu>"
